/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Felipe Duarte
 */
@Entity
@Table(name = "estado_construccion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EstadoConstruccion.findAll", query = "SELECT e FROM EstadoConstruccion e"),
    @NamedQuery(name = "EstadoConstruccion.findByIdEstadoConstruccion", query = "SELECT e FROM EstadoConstruccion e WHERE e.idEstadoConstruccion = :idEstadoConstruccion"),
    @NamedQuery(name = "EstadoConstruccion.findByNombreEstadoConstruccion", query = "SELECT e FROM EstadoConstruccion e WHERE e.nombreEstadoConstruccion = :nombreEstadoConstruccion")})
public class EstadoConstruccion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_ESTADO_CONSTRUCCION")
    private Integer idEstadoConstruccion;
    @Size(max = 45)
    @Column(name = "NOMBRE_ESTADO_CONSTRUCCION")
    private String nombreEstadoConstruccion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "estadoConstruccionIdEstadoConstruccion")
    private List<Construccion> construccionList;

    public EstadoConstruccion() {
    }

    public EstadoConstruccion(Integer idEstadoConstruccion) {
        this.idEstadoConstruccion = idEstadoConstruccion;
    }

    public Integer getIdEstadoConstruccion() {
        return idEstadoConstruccion;
    }

    public void setIdEstadoConstruccion(Integer idEstadoConstruccion) {
        this.idEstadoConstruccion = idEstadoConstruccion;
    }

    public String getNombreEstadoConstruccion() {
        return nombreEstadoConstruccion;
    }

    public void setNombreEstadoConstruccion(String nombreEstadoConstruccion) {
        this.nombreEstadoConstruccion = nombreEstadoConstruccion;
    }

    @XmlTransient
    public List<Construccion> getConstruccionList() {
        return construccionList;
    }

    public void setConstruccionList(List<Construccion> construccionList) {
        this.construccionList = construccionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEstadoConstruccion != null ? idEstadoConstruccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EstadoConstruccion)) {
            return false;
        }
        EstadoConstruccion other = (EstadoConstruccion) object;
        if ((this.idEstadoConstruccion == null && other.idEstadoConstruccion != null) || (this.idEstadoConstruccion != null && !this.idEstadoConstruccion.equals(other.idEstadoConstruccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.EstadoConstruccion[ idEstadoConstruccion=" + idEstadoConstruccion + " ]";
    }
    
}
